//
//  Worker.m
//  oc_分文件创建类
//
//  Created by blue on 16/4/8.
//  Copyright (c) 2016年 zzn. All rights reserved.
//

#import "Worker.h"

@implementation Worker
-(id)init{
    self =[super init];//得到类的对象
   //初始化实例变量
    if(self){
        _name=@"张三";
        _cid=@"19847948470192";
        _salary=4500;
    }
    return self;
}
//带一个参数的构造方法
-(id)initWithName:(NSString *)name{
    self = [super init];
    if(self){
        _name = name;
    }
    return self;
}
-(id)initWithCid:(NSString *)cid{
    self = [super init];
    if(self){
        _cid = cid;
    }
    return self;
}

-(void)setName:(NSString *)name{
    _name = name;
}
-(void)setCid:(NSString *)cid{
    _cid = cid;
}
-(void)setSalary:(double)salary{
    _salary = salary;
}
-(void)setName:(NSString *)name
        andCid:(NSString *)cid
     andSalary:(double)salary{
    _name = name;
    _cid = cid;
    _salary = salary;
}

//getter 获取实例变量的值
//所有的类一定要定义getter方法
-(NSString *)name{
    return _name;
}
-(NSString *)cid{
    return _cid;
}
-(double)salary{
    return _salary;
}
@end
